# to check if rbr settings in pacenote.csv are correct
# anyway pacenote.csv will be abandoned soom

import pandas as pd
from argparse import ArgumentParser
from loguru import logger
# read pacenote.csv

def main():
    parser = ArgumentParser()
    parser.add_argument('--path', type=str, help='path to pacenote.csv')
    args = vars(parser.parse_args())

    path = args['path']
    df = pd.read_csv(path)

    rbr_keys = {}
    for i, row in df.iterrows():
        pacenote_ids = row['RBR_Pacenote_Id']
        pacenote_ids = pacenote_ids.split('|')
        id = row['Id']
        for pacenote_id in pacenote_ids:
            if pacenote_id in rbr_keys and pacenote_id != '-1':
                already_id = rbr_keys[pacenote_id]
                logger.error(f'{pacenote_id} on {id} is already in the list, it\'s on {already_id}')
            else:
                rbr_keys[pacenote_id] = id


    

if __name__ == '__main__':
    main()
